﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Buy3a00
    {
		private string _docno;
        private DateTime? _ordate;
		private string _plistid;
        private DateTime? _backdate;
		private string _arrno;
        private DateTime? _arrdate;
		private string _slistid;
        private int? _ordstatus;
		private double _ordamt;
		private double _accamt;
		private double _gainamt;
		private double _gainpct;
		private string _taxid;
		private double _dutyamt;
        private int? _audstatus;
		private double _agio1;
		private double _agio2;
		private double _agio3;
		private string _remark1;
		private string _remark2;
		private string _usercode;
		private string _listid;
		private double _adjtotalqty;
		private double _adjtotalamt;
		
        /// <summary>
        /// 订单号
        /// </summary>
		public string Docno
		{
			get { return _docno;	 }
			set { _docno=value;	}
		}
        /// <summary>
        /// 订单日期
        /// </summary>
		public DateTime? Ordate
		{
			get { return _ordate;	 }
			set { _ordate=value;	}
		}
        /// <summary>
        /// 供应商主键
        /// </summary>
		public string Plistid
		{
			get { return _plistid;	 }
			set { _plistid=value;	}
		}
        /// <summary>
        /// 应到货日期
        /// </summary>
		public DateTime? Backdate
		{
			get { return _backdate;	 }
			set { _backdate=value;	}
		}
        /// <summary>
        /// 收货号
        /// </summary>
		public string Arrno
		{
			get { return _arrno;	 }
			set { _arrno=value;	}
		}
        /// <summary>
        /// 收货日期
        /// </summary>
		public DateTime? Arrdate
		{
			get { return _arrdate;	 }
			set { _arrdate=value;	}
		}
        /// <summary>
        /// 仓库主键
        /// </summary>
		public string Slistid
		{
			get { return _slistid;	 }
			set { _slistid=value;	}
		}
        /// <summary>
        /// 订单状态
        /// </summary>
		public int? Ordstatus
		{
			get { return _ordstatus;	 }
			set { _ordstatus=value;	}
		}
        /// <summary>
        /// 订货总额
        /// </summary>
		public double Ordamt
		{
			get { return _ordamt;	 }
			set { _ordamt=value;	}
		}
        /// <summary>
        /// 收货总额
        /// </summary>
		public double Accamt
		{
			get { return _accamt;	 }
			set { _accamt=value;	}
		}
        /// <summary>
        /// 毛利总额
        /// </summary>
		public double Gainamt
		{
			get { return _gainamt;	 }
			set { _gainamt=value;	}
		}
        /// <summary>
        /// 毛利率
        /// </summary>
		public double Gainpct
		{
			get { return _gainpct;	 }
			set { _gainpct=value;	}
		}
        /// <summary>
        /// 税率
        /// </summary>
		public string Taxid
		{
			get { return _taxid;	 }
			set { _taxid=value;	}
		}
        /// <summary>
        /// 税额
        /// </summary>
		public double Dutyamt
		{
			get { return _dutyamt;	 }
			set { _dutyamt=value;	}
		}
        /// <summary>
        /// 订单审核状态
        /// </summary>
		public int? Audstatus
		{
			get { return _audstatus;	 }
			set { _audstatus=value;	}
		}
        /// <summary>
        /// 折扣1
        /// </summary>
		public double Agio1
		{
			get { return _agio1;	 }
			set { _agio1=value;	}
		}
        /// <summary>
        /// 折扣2
        /// </summary>
		public double Agio2
		{
			get { return _agio2;	 }
			set { _agio2=value;	}
		}
        /// <summary>
        /// 折扣3
        /// </summary>
		public double Agio3
		{
			get { return _agio3;	 }
			set { _agio3=value;	}
		}
        /// <summary>
        /// 备注1
        /// </summary>
		public string Remark1
		{
			get { return _remark1;	 }
			set { _remark1=value;	}
		}
        /// <summary>
        /// 备注2
        /// </summary>
		public string Remark2
		{
			get { return _remark2;	 }
			set { _remark2=value;	}
		}
        /// <summary>
        /// 用户名
        /// </summary>
		public string Usercode
		{
			get { return _usercode;	 }
			set { _usercode=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public double Adjtotalqty
		{
			get { return _adjtotalqty;	 }
			set { _adjtotalqty=value;	}
		}
        /// <summary>
        /// 
        /// </summary>
		public double Adjtotalamt
		{
			get { return _adjtotalamt;	 }
			set { _adjtotalamt=value;	}
		}
		
		public static List<Buy3a00> GetBuy3a00ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Buy3a00> list = new List<Buy3a00>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Buy3a00 model = GetBuy3a00ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Buy3a00 GetBuy3a00ByDataRow(DataRow dr)
		{
			Buy3a00 model = new Buy3a00(); //实例化Buy3a00
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("docno")&&!(dr["docno"] is System.DBNull))  
				model.Docno = ( string)dr["docno"];
			if (dcc.Contains("ordate")&&!(dr["ordate"] is System.DBNull))  
				model.Ordate = ( DateTime)dr["ordate"];
			if (dcc.Contains("plistid")&&!(dr["plistid"] is System.DBNull))  
				model.Plistid = ( string)dr["plistid"];
			if (dcc.Contains("backdate")&&!(dr["backdate"] is System.DBNull))  
				model.Backdate = ( DateTime)dr["backdate"];
			if (dcc.Contains("arrno")&&!(dr["arrno"] is System.DBNull))  
				model.Arrno = ( string)dr["arrno"];
			if (dcc.Contains("arrdate")&&!(dr["arrdate"] is System.DBNull))  
				model.Arrdate = ( DateTime)dr["arrdate"];
			if (dcc.Contains("slistid")&&!(dr["slistid"] is System.DBNull))  
				model.Slistid = ( string)dr["slistid"];
			if (dcc.Contains("ordstatus")&&!(dr["ordstatus"] is System.DBNull))  
				model.Ordstatus = ( int)dr["ordstatus"];
			if (dcc.Contains("ordamt")&&!(dr["ordamt"] is System.DBNull))  
				model.Ordamt = Convert.ToDouble(dr["ordamt"]);
			if (dcc.Contains("accamt")&&!(dr["accamt"] is System.DBNull))  
				model.Accamt = Convert.ToDouble(dr["accamt"]);
			if (dcc.Contains("gainamt")&&!(dr["gainamt"] is System.DBNull))  
				model.Gainamt = Convert.ToDouble(dr["gainamt"]);
			if (dcc.Contains("gainpct")&&!(dr["gainpct"] is System.DBNull))  
				model.Gainpct = Convert.ToDouble(dr["gainpct"]);
			if (dcc.Contains("taxid")&&!(dr["taxid"] is System.DBNull))  
				model.Taxid = ( string)dr["taxid"];
			if (dcc.Contains("dutyamt")&&!(dr["dutyamt"] is System.DBNull))  
				model.Dutyamt = Convert.ToDouble(dr["dutyamt"]);
			if (dcc.Contains("audstatus")&&!(dr["audstatus"] is System.DBNull))  
				model.Audstatus = ( int)dr["audstatus"];
			if (dcc.Contains("agio1")&&!(dr["agio1"] is System.DBNull))  
				model.Agio1 = Convert.ToDouble(dr["agio1"]);
			if (dcc.Contains("agio2")&&!(dr["agio2"] is System.DBNull))  
				model.Agio2 = Convert.ToDouble(dr["agio2"]);
			if (dcc.Contains("agio3")&&!(dr["agio3"] is System.DBNull))  
				model.Agio3 = Convert.ToDouble(dr["agio3"]);
			if (dcc.Contains("remark1")&&!(dr["remark1"] is System.DBNull))  
				model.Remark1 = ( string)dr["remark1"];
			if (dcc.Contains("remark2")&&!(dr["remark2"] is System.DBNull))  
				model.Remark2 = ( string)dr["remark2"];
			if (dcc.Contains("usercode")&&!(dr["usercode"] is System.DBNull))  
				model.Usercode = ( string)dr["usercode"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			if (dcc.Contains("adjtotalqty")&&!(dr["adjtotalqty"] is System.DBNull))  
				model.Adjtotalqty = Convert.ToDouble(dr["adjtotalqty"]);
			if (dcc.Contains("adjtotalamt")&&!(dr["adjtotalamt"] is System.DBNull))  
				model.Adjtotalamt = Convert.ToDouble(dr["adjtotalamt"]);
			
			return model;
		}
    }
}
